UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8E2oDOU91b9pB0wIhMOAeESITD6s5uVMimWt/CQm2h4=' 
WHERE 
  key_id = 'ba186424cc26b282504d4015a9be6a46820c91b284386efe85ed2bb14fb87e1a' 
  AND (
    token = '8E2oDOU91b9pB0wIhMOAeESITD6s5uVMimWt/CQm2h4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038