UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bcxyMugBq9tHQF5fVOrbyIFtW4rFwTuLs2FRDKZvY/E=' 
WHERE 
  key_id = '29f7678bcc20e45f14ead668d04348303441faf12a972c32025672d8e8be6fd6' 
  AND (
    token = 'bcxyMugBq9tHQF5fVOrbyIFtW4rFwTuLs2FRDKZvY/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031