UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H9Fh/eX+bNdmzhpwW8l8DWiBL9sfBEIb813W780QN7Y=' 
WHERE 
  key_id = '119b550c57046a0090d9d47da29c8c95f0358a348eb0df35dfbf8a0b310f22f5' 
  AND (
    token = 'H9Fh/eX+bNdmzhpwW8l8DWiBL9sfBEIb813W780QN7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048