UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aUi+O3mpsJFsxpaYUntehR2wpj6KYlOzXvfrlECyKG0=' 
WHERE 
  key_id = '4a03335755bf62311623a4bbfa14139b204a5354fbc8746d1623a03e9d3a60f8' 
  AND (
    token = 'aUi+O3mpsJFsxpaYUntehR2wpj6KYlOzXvfrlECyKG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037