UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NKxs7MFvxNiB5FN8GVR0XrnSvXHSchf8NfFQ+m79bs8=' 
WHERE 
  key_id = 'ee6137d0fac201985894d5202079745d888b18f3a518ba64718fcac7035abb9f' 
  AND (
    token = 'NKxs7MFvxNiB5FN8GVR0XrnSvXHSchf8NfFQ+m79bs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00113