UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BsAK9OEef57ZQeZ+0lGtjRSQVqHLA9adZ67dEn7sT4U=' 
WHERE 
  key_id = '42a4fea98ed907781330986cd24203ec6e18651f216148b428cadf9c79c2e8bc' 
  AND (
    token = 'BsAK9OEef57ZQeZ+0lGtjRSQVqHLA9adZ67dEn7sT4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038