UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8SN4r34EKj0YGFdVXnFDmW7xqB98ZQ8p1fP/dA2IZRQ=' 
WHERE 
  key_id = 'cf969083ce0d406e82910894f60e3c511001b28a0cdf2818d819d634913ef437' 
  AND (
    token = '8SN4r34EKj0YGFdVXnFDmW7xqB98ZQ8p1fP/dA2IZRQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035