UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uhs/KXJVgPR7FSWy0jjheS9VbJn942vw8Re8kjNElpQ=' 
WHERE 
  key_id = 'b15d24aaab5ac7ecfdd6d1c958e2ddcfe44542fd45b263de8bde276f16125054' 
  AND (
    token = 'uhs/KXJVgPR7FSWy0jjheS9VbJn942vw8Re8kjNElpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040