UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cxc+Hp5ZP1ZU2UiGXYiWDk+6lovaaBwYLmFB6Q5p1IY=' 
WHERE 
  key_id = '3d4905a51e99803fc277ff53319e809a3961693a517fec86208a4136ddb48795' 
  AND (
    token = 'Cxc+Hp5ZP1ZU2UiGXYiWDk+6lovaaBwYLmFB6Q5p1IY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045