UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ve9Nu4cFPpr/o3YQ6T/JCzehtdhly2kE91mdCIKFcYM=' 
WHERE 
  key_id = 'eb9ef925ca83a56f2a28fc2a956ca61416765e4777c7d67cce12cc041141e048' 
  AND (
    token = 'Ve9Nu4cFPpr/o3YQ6T/JCzehtdhly2kE91mdCIKFcYM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044