UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WJmpV2A35YLLeqdQTkfzUHHPqLzR40ACZ78rilCoYPw=' 
WHERE 
  key_id = 'aee567e3ae4c1254727b5ae6358063f51d249c3cb445816ee1c98e027a0b7883' 
  AND (
    token = 'WJmpV2A35YLLeqdQTkfzUHHPqLzR40ACZ78rilCoYPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026