UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K196MXhdZh0nzpl9Qv/0TELBxWd7kkzoCcjYLCVAVao=' 
WHERE 
  key_id = '23d3c360215758fd1f3de234301d875f84206213208cc57aa60600aefe2e9e39' 
  AND (
    token = 'K196MXhdZh0nzpl9Qv/0TELBxWd7kkzoCcjYLCVAVao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048