UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hkfJSPI5gsn5y2fNmRX7DW2JeUFbjRRvzmzeffBrEo0=' 
WHERE 
  key_id = '3cb7ae89c8990d7595cb11085cf7f1293a421cb0b76da93b3b93814a72994e8c' 
  AND (
    token = 'hkfJSPI5gsn5y2fNmRX7DW2JeUFbjRRvzmzeffBrEo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028