UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NKowbX218Ek+eXieps9DHS7eUUcSzrxqar85wTrBq0s=' 
WHERE 
  key_id = '1e6d9f2bc5cb0d61b83f1cf3273fab16bfeb266d72a666bc8ace5a09f902e843' 
  AND (
    token = 'NKowbX218Ek+eXieps9DHS7eUUcSzrxqar85wTrBq0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024