UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DyURIRVQdNs8VWt3/eCMYYeRo6I208WzLgoVHkRNTHY=' 
WHERE 
  key_id = '4cbc87919066dcd2478f1b3c29c2b53367bc7b9e3cd253da87de477ac80ac607' 
  AND (
    token = 'DyURIRVQdNs8VWt3/eCMYYeRo6I208WzLgoVHkRNTHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082