UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cUw5MSwd/G/JHciTuZagcEBngtvrLqiNXwEkSJEO6Ew=' 
WHERE 
  key_id = '4cf5979a8af05c6a589c96bee95dd333cad4f603d131cfbd5954e5c78dc8e81d' 
  AND (
    token = 'cUw5MSwd/G/JHciTuZagcEBngtvrLqiNXwEkSJEO6Ew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033