UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PNYqQv80Xi2LxiNJsEI8R9+TYERj08afPFit96W7nfE=' 
WHERE 
  key_id = '806813bfe7b4d68539201bd0ce7fbcc93e90a8066a93a5728c8ff146bb986ca9' 
  AND (
    token = 'PNYqQv80Xi2LxiNJsEI8R9+TYERj08afPFit96W7nfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045