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

Query time 0.00047