UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VyMrBXNzUEXqKbkjrohrGJdgiCBqn2VUK92B+fdCGR8=' 
WHERE 
  key_id = '065958deff778be9d11fc6182a99b5163806ca170b08f95bdf4b85121cb877c2' 
  AND (
    token = 'VyMrBXNzUEXqKbkjrohrGJdgiCBqn2VUK92B+fdCGR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023