UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WpXgPWLUahzEUeg6Q++rf7Ex/4rnvLSfKn9MSGmnTxw=' 
WHERE 
  key_id = '5ef2e05479921710a6801d20362e535941ed5d71d0997df5c6358b0047578f15' 
  AND (
    token = 'WpXgPWLUahzEUeg6Q++rf7Ex/4rnvLSfKn9MSGmnTxw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024