UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aF3X+/yPA3r3qCls3Nd8pHfxYIzq4EBkqoSLqn+Kcp4=' 
WHERE 
  key_id = '9b55b32a5af665cf9d02df628a64071e4a0737e7ab7ed421491edb3d7858cfb6' 
  AND (
    token = 'aF3X+/yPA3r3qCls3Nd8pHfxYIzq4EBkqoSLqn+Kcp4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051