UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0sr1vzr6kNMHwKZfsx0z8UbfpLDWZyjm3EBZEPJBGA0=' 
WHERE 
  key_id = 'edc815418f6bedf7e6d73a8cf2f007202a743d45e0e92911c1ae341011e40a65' 
  AND (
    token = '0sr1vzr6kNMHwKZfsx0z8UbfpLDWZyjm3EBZEPJBGA0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042