UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't1Au9yZr8msdGPAQ+J3gQLhS7VPJFT7xdPdZ9tvbq64=' 
WHERE 
  key_id = '39b262ede29cbe6a8a7cda442623a84c50df1d6a825274317b412dd67553832c' 
  AND (
    token = 't1Au9yZr8msdGPAQ+J3gQLhS7VPJFT7xdPdZ9tvbq64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040