UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YFb2ORlbil2l4nQ1fIWwqfY64QBqgbC+2GTldyvg37M=' 
WHERE 
  key_id = '3c7fe75ca90104fa2798ffaf25d2298396d9057041f06069b586366b3edd1a4c' 
  AND (
    token = 'YFb2ORlbil2l4nQ1fIWwqfY64QBqgbC+2GTldyvg37M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043