UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pHmDjUyLVs7w2CBTkRDJhhmg4NMRaLqezNEeWtEGHSk=' 
WHERE 
  key_id = '1bd87d267f4fa9b66630c65b108eafd89fc36e4da9efbb38790e9f2d541792e4' 
  AND (
    token = 'pHmDjUyLVs7w2CBTkRDJhhmg4NMRaLqezNEeWtEGHSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031