UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7s9YN2USCb41/AtmSBHbOc+hMm7zgdEy4QP3cMz3+CI=' 
WHERE 
  key_id = '640689d44066228f36a6e2578c291dc37e75a5bbe08cc3b32dc990775aeafe44' 
  AND (
    token = '7s9YN2USCb41/AtmSBHbOc+hMm7zgdEy4QP3cMz3+CI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022