UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a6FC2QHGXizR6lEwdT5q/GHH4dbMud3Cd+3i5hSF1UE=' 
WHERE 
  key_id = '437ba29e7150b1bc27be6a3b4ec771eabc5f844298da8d49035d30122999bfd3' 
  AND (
    token = 'a6FC2QHGXizR6lEwdT5q/GHH4dbMud3Cd+3i5hSF1UE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028