UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZoZN+NM9DizbI3HcV6ZjkQHV0/S9d+kEnwC7MalVbdI=' 
WHERE 
  key_id = 'b732555de4790d60a69d01bac9a4a8840e13141d2c824d946d33cf8ed98c20f5' 
  AND (
    token = 'ZoZN+NM9DizbI3HcV6ZjkQHV0/S9d+kEnwC7MalVbdI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032